﻿namespace Anley.DomainDrivenDesign.Contract.Domain;

/// <summary>
/// 实体接口
/// </summary>
public interface IEntity<TKey>
    where TKey : struct
{
    /// <summary>
    /// 主键
    /// </summary>
    TKey Id { get; }
}

/// <summary>
/// 实体接口
/// </summary>
public interface IEntity
    : IEntity<int>
{
}

/// <summary>
/// 可创建实体接口
/// </summary>
public interface ICreatableEntity<TKey>
    : IEntity<TKey>
    where TKey : struct
{
    /// <summary>
    /// 创建时间
    /// </summary>
    DateTime CreatedTime { get; }

    /// <summary>
    /// 创建人
    /// </summary>
    string Creater { get; }
}

/// <summary>
/// 可创建实体接口
/// </summary>
public interface ICreatableEntity
    : ICreatableEntity<int>, IEntity
{
}

/// <summary>
/// 可更新实体接口
/// </summary>
/// <typeparam name="TKey"></typeparam>
public interface IUpdatableEntity<TKey>
    : ICreatableEntity<TKey>
    where TKey : struct
{
    /// <summary>
    /// 更新时间
    /// </summary>
    DateTime? UpdatedTime { get; }

    /// <summary>
    /// 更新人
    /// </summary>
    string? Updater { get; }
}

/// <summary>
/// 可更新实体接口
/// </summary>
public interface IUpdatableEntity
    : IUpdatableEntity<int>, ICreatableEntity
{
}

/// <summary>
/// 可删除实体接口
/// </summary>
public interface IDeletableEntity<TKey>
    : IUpdatableEntity<TKey>
    where TKey : struct
{
    /// <summary>
    /// 是否已删除
    /// </summary>
    bool IsDeleted { get; }

    /// <summary>
    /// 删除时间
    /// </summary>
    DateTime? DeletedTime { get; }

    /// <summary>
    /// 删除人
    /// </summary>
    string? Deleter { get; }
}

/// <summary>
/// 可删除实体接口
/// </summary>
public interface IDeletableEntity
    : IDeletableEntity<int>
{
}